﻿using IAD13.fromTDDtoBDD.Exceptions;
using NUnit.Framework;

namespace IAD13.fromTDDtoBDD.BDD.given_an_account.with_any_balance
{
    public class when_I_try_withdrawal_greater_than_balance : with_any_balance
    {
        private WithdrawalGreaterThanBalanceException expectedException;

        protected override void When()
        {
            expectedException = Catch<WithdrawalGreaterThanBalanceException>(() => sut.Withdrawal(Amount.OfEuro(120)));
        }

        [Then]
        public void It_should_throw_exception_WithdrawalGreaterThanBalance()
        {
            Assert.IsAssignableFrom<WithdrawalGreaterThanBalanceException>(expectedException);
        }
        
        [Then]
        public void It_should_not_change_balance()
        {
            Assert.AreEqual(Amount.OfEuro(10), sut.Balance());
        }
    }
}